<template>
    <div>
        <el-form ref="formRef" style="padding: 0 8px" label-width="130px" :model="formData">
            <el-card class="!border-none mb-4">
                <div class="font-medium mb-7">企业微信:
                </div>
                <el-form-item label="CorpID">
                    <div class="w-80">
                        <el-input class="w-[500px]" placeholder="请输入CorpID" v-model="formData.corp_id" clearable>
                        </el-input>
                    </div>
                </el-form-item>
                <el-form-item label="ProviderSecret">
                    <div class="w-80">
                        <el-input class="w-[500px]" placeholder="请输入ProviderSecret" clearable v-model="formData.secret"  type="textarea" :rows="5">
                        </el-input>
                    </div>
                </el-form-item>
                <el-form-item label="SuiteID">
                    <div class="w-80">
                        <el-input class="w-[500px]" placeholder="请输入SuiteID" v-model="formData.suite_id" clearable>
                        </el-input>
                    </div>
                </el-form-item>
                <el-form-item label="Secret">
                    <div class="w-80">
                        <el-input class="w-[500px]" placeholder="请输入Secret" clearable v-model="formData.suite_secret"  type="textarea" :rows="5">
                        </el-input>
                    </div>
                </el-form-item>
                <el-form-item label="Token">
                    <div class="w-80">
                        <el-input class="w-[500px]" placeholder="请输入Token" v-model="formData.token" clearable>
                        </el-input>
                    </div>
                </el-form-item>
                <el-form-item label="EncodingAESKey">
                    <div class="w-80">
                        <el-input class="w-[500px]" placeholder="请输入EncodingAESKey" clearable v-model="formData.aes_key"  type="textarea" :rows="5">
                        </el-input>
                    </div>
                </el-form-item>
                <el-form-item label="服务商组件回调地址:">
                    <div class="w-80">
                        <el-input class="w-[500px]" placeholder="" v-model="formData.fws_url" disabled>
                        </el-input>
                    </div>
                    <el-button v-copy="formData.fws_url" type="primary">复制</el-button>
                </el-form-item>
            </el-card>
        </el-form>
        <footer-btns>
            <el-button type="primary" @click="addHandle">保存</el-button>
        </footer-btns>
    </div>
</template>
<script lang="ts" setup>
import {
    get_wechat_work_config,
    set_wechat_work_config
} from '@/api/setting/qyvx'
const formData = ref({
    corp_id: "",
    secret: "",
    suite_id: "",
    suite_secret: "",
    token: "",
    aes_key: "",
    fws_url:""
})
const gerLists = async () => {
    const results = await get_wechat_work_config({})
    formData.value = results
}
const addHandle = async () => {
    await set_wechat_work_config(formData.value)
}
gerLists()
</script>